<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="单价" prop="Price">
        <el-input
          v-model="queryParams.Price"
          placeholder="请输入单价"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="年份" prop="YEARs">
        <el-input
          v-model="queryParams.YEARs"
          placeholder="请输入年份"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="周别" prop="wk">
        <el-input
          v-model="queryParams.wk"
          placeholder="请输入周别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="到付日期" prop="DFDate">
        <el-date-picker clearable
          v-model="queryParams.DFDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择到付日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="最后付款日" prop="PayDate">
        <el-date-picker clearable
          v-model="queryParams.PayDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择最后付款日">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="应收到期日期" prop="YSDQDate">
        <el-date-picker clearable
          v-model="queryParams.YSDQDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择应收到期日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="收款比例" prop="SKBL">
        <el-input
          v-model="queryParams.SKBL"
          placeholder="请输入收款比例"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收款日期" prop="YRecDate">
        <el-date-picker clearable
          v-model="queryParams.YRecDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择收款日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:fztz:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:fztz:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:fztz:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:fztz:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="fztzList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="单价" align="center" prop="Price" />
      <el-table-column label="合同单价" align="center" prop="PurPrice" />
      <el-table-column label="年份" align="center" prop="YEARs" />
      <el-table-column label="周别" align="center" prop="wk" />
      <el-table-column label="PI状态" align="center" prop="PIStatus" />
      <el-table-column label="形式发票号" align="center" prop="BillNo" />
      <el-table-column label="季节" align="center" prop="Season" />
      <el-table-column label="款号" align="center" prop="GoodsNo" />
      <el-table-column label="批号" align="center" prop="BatchNo" />
      <el-table-column label="客户简称" align="center" prop="CustomerName" />
      <el-table-column label="跟单业务" align="center" prop="userName" />
      <el-table-column label="客人货期" align="center" prop="DeliveryDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.DeliveryDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="数量" align="center" prop="Num" />
      <el-table-column label="金额" align="center" prop="GoodsAmount" />
      <el-table-column label="合同货币单位" align="center" prop="Currency" />
      <el-table-column label="备注" align="center" prop="Remark" />
      <el-table-column label="PI明细ID" align="center" prop="ExpContractDetailID" />
      <el-table-column label="预计利润率" align="center" prop="YJLRL" />
      <el-table-column label="预计毛利" align="center" prop="YJML" />
      <el-table-column label="实际利润率" align="center" prop="SJLRL" />
      <el-table-column label="实际毛利 " align="center" prop="SJML" />
      <el-table-column label="工厂出货状态" align="center" prop="GCStatus" />
      <el-table-column label="工厂" align="center" prop="SupplierShortName" />
      <el-table-column label="工厂交期" align="center" prop="pDeliveryDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.pDeliveryDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="合同数量" align="center" prop="PurNum" />
      <el-table-column label="合同金额" align="center" prop="PurAmount" />
      <el-table-column label="工厂货币单位" align="center" prop="PurCurrency" />
      <el-table-column label="出货数量" align="center" prop="ShipNum" />
      <el-table-column label="到付日期" align="center" prop="DFDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.DFDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="应付金额" align="center" prop="AccountMoney" />
      <el-table-column label="最后付款日" align="center" prop="PayDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.PayDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="付款比例" align="center" prop="FKBL" />
      <el-table-column label="付款状态" align="center" prop="FKStatus" />
      <el-table-column label="采购金额" align="center" prop="CGAmount" />
      <el-table-column label="采购占比" align="center" prop="CGZB" />
      <el-table-column label="成品外协占比" align="center" prop="CPRatio" />
      <el-table-column label="部件外协占比" align="center" prop="BJRatio" />
      <el-table-column label="面料采购占比" align="center" prop="FabricRatio" />
      <el-table-column label="辅料采购占比" align="center" prop="AccessoriesRatio" />
      <el-table-column label="外采外协合计占比" align="center" prop="OutsourcingRatio" />
      <el-table-column label="外采外协合计" align="center" prop="Outsourcing" />
      <el-table-column label="面料采购金额" align="center" prop="PurFGoodsAmount" />
      <el-table-column label="境内面料采购金额" align="center" prop="JnPurFGoodsAmount" />
      <el-table-column label="境外面料采购金额" align="center" prop="JWPurFGoodsAmount" />
      <el-table-column label="辅料采购金额" align="center" prop="PurAGoodsAmount" />
      <el-table-column label="境内辅料采购金额" align="center" prop="JnPurAGoodsAmount" />
      <el-table-column label="境外辅料采购金额" align="center" prop="JWPurAGoodsAmount" />
      <el-table-column label="其他采购费用" align="center" prop="QTCHAmount" />
      <el-table-column label="面料入库金额" align="center" prop="RKAmount" />
      <el-table-column label="面料出库金额" align="center" prop="rkamountF" />
      <el-table-column label="面料出库金额" align="center" prop="CKAmount" />
      <el-table-column label="辅料出库金额" align="center" prop="ckamountF" />
      <el-table-column label="收款状态" align="center" prop="SKStatus" />
      <el-table-column label="付款方式" align="center" prop="PaymentType" />
      <el-table-column label="实际出货数量" align="center" prop="SJShipNum" />
      <el-table-column label="ETD" align="center" prop="InvoiceDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.InvoiceDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="应收到期日期" align="center" prop="YSDQDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.YSDQDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="应收金额" align="center" prop="SAccountMoney" />
      <el-table-column label="实收金额" align="center" prop="TotalReceivedMoney" />
      <el-table-column label="手续费" align="center" prop="SXFee" />
      <el-table-column label="收款日期" align="center" prop="RecDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.RecDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="收款货币" align="center" prop="currencyName" />
      <el-table-column label="应收未收" align="center" prop="UnReceivedMoney" />
      <el-table-column label="新应收未收" align="center" prop="unreceivedmoneyNew" />
      <el-table-column label="收款比例" align="center" prop="SKBL" />
      <el-table-column label="申请金额" align="center" prop="SQPaidAmount" />
      <el-table-column label="未申请金额" align="center" prop="WSQUnPayMoney" />
      <el-table-column label="已付金额" align="center" prop="ActualAmount" />
      <el-table-column label="申请未付金额" align="center" prop="SQUNPaidAmount" />
      <el-table-column label="应付未付" align="center" prop="SQUnPayMoney" />
      <el-table-column label="已付尾款金额" align="center" prop="PAmount" />
      <el-table-column label="预付金额" align="center" prop="yAmount" />
      <el-table-column label="订金比例" align="center" prop="DJBL" />
      <el-table-column label="订金金额" align="center" prop="DJAmount" />
      <el-table-column label="订金应付日期" align="center" prop="DJYFDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.DJYFDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="收款日期" align="center" prop="YRecDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.YRecDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="订金实收金额" align="center" prop="YWriteAmount" />
      <el-table-column label="加项" align="center" prop="Addition" />
      <el-table-column label="减项" align="center" prop="Subtract" />
      <el-table-column label="userID" align="center" prop="userID" />
      <el-table-column label="工厂合同确认日期" align="center" prop="GCContractDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.GCContractDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="部件外协金额" align="center" prop="BJGoodsAmount" />
      <el-table-column label="成品外协金额" align="center" prop="CPGoodsAmount" />
      <el-table-column label="CBS成本" align="center" prop="cbsMf" />
      <el-table-column label="CBS费用" align="center" prop="cbsFee" />
      <el-table-column label="外协金额限额" align="center" prop="WXGoodsAmountLimit" />
      <el-table-column label="损失承担金额" align="center" prop="LossAmount" />
      <el-table-column label="Credit抵扣金额" align="center" prop="CreditAmount" />
      <el-table-column label="公司简称" align="center" prop="CompanyShortName" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:fztz:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:fztz:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改服装鞋部合同台账对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="单价" prop="Price">
          <el-input v-model="form.Price" placeholder="请输入单价" />
        </el-form-item>
        <el-form-item label="合同单价" prop="PurPrice">
          <el-input v-model="form.PurPrice" placeholder="请输入合同单价" />
        </el-form-item>
        <el-form-item label="年份" prop="YEARs">
          <el-input v-model="form.YEARs" placeholder="请输入年份" />
        </el-form-item>
        <el-form-item label="周别" prop="wk">
          <el-input v-model="form.wk" placeholder="请输入周别" />
        </el-form-item>
        <el-form-item label="形式发票号" prop="BillNo">
          <el-input v-model="form.BillNo" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="季节" prop="Season">
          <el-input v-model="form.Season" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="款号" prop="GoodsNo">
          <el-input v-model="form.GoodsNo" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="批号" prop="BatchNo">
          <el-input v-model="form.BatchNo" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="客户简称" prop="CustomerName">
          <el-input v-model="form.CustomerName" placeholder="请输入客户简称" />
        </el-form-item>
        <el-form-item label="跟单业务" prop="userName">
          <el-input v-model="form.userName" placeholder="请输入跟单业务" />
        </el-form-item>
        <el-form-item label="客人货期" prop="DeliveryDate">
          <el-date-picker clearable
            v-model="form.DeliveryDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择客人货期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="数量" prop="Num">
          <el-input v-model="form.Num" placeholder="请输入数量" />
        </el-form-item>
        <el-form-item label="金额" prop="GoodsAmount">
          <el-input v-model="form.GoodsAmount" placeholder="请输入金额" />
        </el-form-item>
        <el-form-item label="合同货币单位" prop="Currency">
          <el-input v-model="form.Currency" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注" prop="Remark">
          <el-input v-model="form.Remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="PI明细ID" prop="ExpContractDetailID">
          <el-input v-model="form.ExpContractDetailID" placeholder="请输入PI明细ID" />
        </el-form-item>
        <el-form-item label="预计利润率" prop="YJLRL">
          <el-input v-model="form.YJLRL" placeholder="请输入预计利润率" />
        </el-form-item>
        <el-form-item label="预计毛利" prop="YJML">
          <el-input v-model="form.YJML" placeholder="请输入预计毛利" />
        </el-form-item>
        <el-form-item label="实际利润率" prop="SJLRL">
          <el-input v-model="form.SJLRL" placeholder="请输入实际利润率" />
        </el-form-item>
        <el-form-item label="实际毛利 " prop="SJML">
          <el-input v-model="form.SJML" placeholder="请输入实际毛利 " />
        </el-form-item>
        <el-form-item label="工厂" prop="SupplierShortName">
          <el-input v-model="form.SupplierShortName" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="工厂交期" prop="pDeliveryDate">
          <el-date-picker clearable
            v-model="form.pDeliveryDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择工厂交期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="合同数量" prop="PurNum">
          <el-input v-model="form.PurNum" placeholder="请输入合同数量" />
        </el-form-item>
        <el-form-item label="合同金额" prop="PurAmount">
          <el-input v-model="form.PurAmount" placeholder="请输入合同金额" />
        </el-form-item>
        <el-form-item label="工厂货币单位" prop="PurCurrency">
          <el-input v-model="form.PurCurrency" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="出货数量" prop="ShipNum">
          <el-input v-model="form.ShipNum" placeholder="请输入出货数量" />
        </el-form-item>
        <el-form-item label="到付日期" prop="DFDate">
          <el-date-picker clearable
            v-model="form.DFDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择到付日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="应付金额" prop="AccountMoney">
          <el-input v-model="form.AccountMoney" placeholder="请输入应付金额" />
        </el-form-item>
        <el-form-item label="最后付款日" prop="PayDate">
          <el-date-picker clearable
            v-model="form.PayDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择最后付款日">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="付款比例" prop="FKBL">
          <el-input v-model="form.FKBL" placeholder="请输入付款比例" />
        </el-form-item>
        <el-form-item label="采购金额" prop="CGAmount">
          <el-input v-model="form.CGAmount" placeholder="请输入采购金额" />
        </el-form-item>
        <el-form-item label="采购占比" prop="CGZB">
          <el-input v-model="form.CGZB" placeholder="请输入采购占比" />
        </el-form-item>
        <el-form-item label="成品外协占比" prop="CPRatio">
          <el-input v-model="form.CPRatio" placeholder="请输入成品外协占比" />
        </el-form-item>
        <el-form-item label="部件外协占比" prop="BJRatio">
          <el-input v-model="form.BJRatio" placeholder="请输入部件外协占比" />
        </el-form-item>
        <el-form-item label="面料采购占比" prop="FabricRatio">
          <el-input v-model="form.FabricRatio" placeholder="请输入面料采购占比" />
        </el-form-item>
        <el-form-item label="辅料采购占比" prop="AccessoriesRatio">
          <el-input v-model="form.AccessoriesRatio" placeholder="请输入辅料采购占比" />
        </el-form-item>
        <el-form-item label="外采外协合计占比" prop="OutsourcingRatio">
          <el-input v-model="form.OutsourcingRatio" placeholder="请输入外采外协合计占比" />
        </el-form-item>
        <el-form-item label="外采外协合计" prop="Outsourcing">
          <el-input v-model="form.Outsourcing" placeholder="请输入外采外协合计" />
        </el-form-item>
        <el-form-item label="面料采购金额" prop="PurFGoodsAmount">
          <el-input v-model="form.PurFGoodsAmount" placeholder="请输入面料采购金额" />
        </el-form-item>
        <el-form-item label="境内面料采购金额" prop="JnPurFGoodsAmount">
          <el-input v-model="form.JnPurFGoodsAmount" placeholder="请输入境内面料采购金额" />
        </el-form-item>
        <el-form-item label="境外面料采购金额" prop="JWPurFGoodsAmount">
          <el-input v-model="form.JWPurFGoodsAmount" placeholder="请输入境外面料采购金额" />
        </el-form-item>
        <el-form-item label="辅料采购金额" prop="PurAGoodsAmount">
          <el-input v-model="form.PurAGoodsAmount" placeholder="请输入辅料采购金额" />
        </el-form-item>
        <el-form-item label="境内辅料采购金额" prop="JnPurAGoodsAmount">
          <el-input v-model="form.JnPurAGoodsAmount" placeholder="请输入境内辅料采购金额" />
        </el-form-item>
        <el-form-item label="境外辅料采购金额" prop="JWPurAGoodsAmount">
          <el-input v-model="form.JWPurAGoodsAmount" placeholder="请输入境外辅料采购金额" />
        </el-form-item>
        <el-form-item label="其他采购费用" prop="QTCHAmount">
          <el-input v-model="form.QTCHAmount" placeholder="请输入其他采购费用" />
        </el-form-item>
        <el-form-item label="面料入库金额" prop="RKAmount">
          <el-input v-model="form.RKAmount" placeholder="请输入面料入库金额" />
        </el-form-item>
        <el-form-item label="面料出库金额" prop="rkamountF">
          <el-input v-model="form.rkamountF" placeholder="请输入面料出库金额" />
        </el-form-item>
        <el-form-item label="面料出库金额" prop="CKAmount">
          <el-input v-model="form.CKAmount" placeholder="请输入面料出库金额" />
        </el-form-item>
        <el-form-item label="辅料出库金额" prop="ckamountF">
          <el-input v-model="form.ckamountF" placeholder="请输入辅料出库金额" />
        </el-form-item>
        <el-form-item label="实际出货数量" prop="SJShipNum">
          <el-input v-model="form.SJShipNum" placeholder="请输入实际出货数量" />
        </el-form-item>
        <el-form-item label="ETD" prop="InvoiceDate">
          <el-date-picker clearable
            v-model="form.InvoiceDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择ETD">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="应收到期日期" prop="YSDQDate">
          <el-date-picker clearable
            v-model="form.YSDQDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择应收到期日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="应收金额" prop="SAccountMoney">
          <el-input v-model="form.SAccountMoney" placeholder="请输入应收金额" />
        </el-form-item>
        <el-form-item label="实收金额" prop="TotalReceivedMoney">
          <el-input v-model="form.TotalReceivedMoney" placeholder="请输入实收金额" />
        </el-form-item>
        <el-form-item label="手续费" prop="SXFee">
          <el-input v-model="form.SXFee" placeholder="请输入手续费" />
        </el-form-item>
        <el-form-item label="收款日期" prop="RecDate">
          <el-date-picker clearable
            v-model="form.RecDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择收款日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="收款货币" prop="currencyName">
          <el-input v-model="form.currencyName" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="应收未收" prop="UnReceivedMoney">
          <el-input v-model="form.UnReceivedMoney" placeholder="请输入应收未收" />
        </el-form-item>
        <el-form-item label="新应收未收" prop="unreceivedmoneyNew">
          <el-input v-model="form.unreceivedmoneyNew" placeholder="请输入新应收未收" />
        </el-form-item>
        <el-form-item label="收款比例" prop="SKBL">
          <el-input v-model="form.SKBL" placeholder="请输入收款比例" />
        </el-form-item>
        <el-form-item label="${comment}" prop="id">
          <el-input v-model="form.id" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="申请金额" prop="SQPaidAmount">
          <el-input v-model="form.SQPaidAmount" placeholder="请输入申请金额" />
        </el-form-item>
        <el-form-item label="未申请金额" prop="WSQUnPayMoney">
          <el-input v-model="form.WSQUnPayMoney" placeholder="请输入未申请金额" />
        </el-form-item>
        <el-form-item label="已付金额" prop="ActualAmount">
          <el-input v-model="form.ActualAmount" placeholder="请输入已付金额" />
        </el-form-item>
        <el-form-item label="申请未付金额" prop="SQUNPaidAmount">
          <el-input v-model="form.SQUNPaidAmount" placeholder="请输入申请未付金额" />
        </el-form-item>
        <el-form-item label="应付未付" prop="SQUnPayMoney">
          <el-input v-model="form.SQUnPayMoney" placeholder="请输入应付未付" />
        </el-form-item>
        <el-form-item label="已付尾款金额" prop="PAmount">
          <el-input v-model="form.PAmount" placeholder="请输入已付尾款金额" />
        </el-form-item>
        <el-form-item label="预付金额" prop="yAmount">
          <el-input v-model="form.yAmount" placeholder="请输入预付金额" />
        </el-form-item>
        <el-form-item label="订金比例" prop="DJBL">
          <el-input v-model="form.DJBL" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="订金金额" prop="DJAmount">
          <el-input v-model="form.DJAmount" placeholder="请输入订金金额" />
        </el-form-item>
        <el-form-item label="订金应付日期" prop="DJYFDate">
          <el-date-picker clearable
            v-model="form.DJYFDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择订金应付日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="收款日期" prop="YRecDate">
          <el-date-picker clearable
            v-model="form.YRecDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择收款日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="订金实收金额" prop="YWriteAmount">
          <el-input v-model="form.YWriteAmount" placeholder="请输入订金实收金额" />
        </el-form-item>
        <el-form-item label="加项" prop="Addition">
          <el-input v-model="form.Addition" placeholder="请输入加项" />
        </el-form-item>
        <el-form-item label="减项" prop="Subtract">
          <el-input v-model="form.Subtract" placeholder="请输入减项" />
        </el-form-item>
        <el-form-item label="userID" prop="userID">
          <el-input v-model="form.userID" placeholder="请输入userID" />
        </el-form-item>
        <el-form-item label="工厂合同确认日期" prop="GCContractDate">
          <el-date-picker clearable
            v-model="form.GCContractDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择工厂合同确认日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="部件外协金额" prop="BJGoodsAmount">
          <el-input v-model="form.BJGoodsAmount" placeholder="请输入部件外协金额" />
        </el-form-item>
        <el-form-item label="成品外协金额" prop="CPGoodsAmount">
          <el-input v-model="form.CPGoodsAmount" placeholder="请输入成品外协金额" />
        </el-form-item>
        <el-form-item label="CBS成本" prop="cbsMf">
          <el-input v-model="form.cbsMf" placeholder="请输入CBS成本" />
        </el-form-item>
        <el-form-item label="CBS费用" prop="cbsFee">
          <el-input v-model="form.cbsFee" placeholder="请输入CBS费用" />
        </el-form-item>
        <el-form-item label="外协金额限额" prop="WXGoodsAmountLimit">
          <el-input v-model="form.WXGoodsAmountLimit" placeholder="请输入外协金额限额" />
        </el-form-item>
        <el-form-item label="损失承担金额" prop="LossAmount">
          <el-input v-model="form.LossAmount" placeholder="请输入损失承担金额" />
        </el-form-item>
        <el-form-item label="Credit抵扣金额" prop="CreditAmount">
          <el-input v-model="form.CreditAmount" placeholder="请输入Credit抵扣金额" />
        </el-form-item>
        <el-form-item label="公司简称" prop="CompanyShortName">
          <el-input v-model="form.CompanyShortName" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listFztz, getFztz, delFztz, addFztz, updateFztz } from "@/api/system/fztz";

export default {
  name: "Fztz",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 服装鞋部合同台账表格数据
      fztzList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        Price: null,
        YEARs: null,
        wk: null,
        Season: null,
        GoodsNo: null,
        SupplierShortName: null,
        DFDate: null,
        PayDate: null,
        YSDQDate: null,
        currencyName: null,
        SKBL: null,
        YRecDate: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        ExpContractDetailID: [
          { required: true, message: "PI明细ID不能为空", trigger: "blur" }
        ],
        YJML: [
          { required: true, message: "预计毛利不能为空", trigger: "blur" }
        ],
        SJML: [
          { required: true, message: "实际毛利 不能为空", trigger: "blur" }
        ],
        GCStatus: [
          { required: true, message: "工厂出货状态不能为空", trigger: "change" }
        ],
        FKStatus: [
          { required: true, message: "付款状态不能为空", trigger: "change" }
        ],
        CGAmount: [
          { required: true, message: "采购金额不能为空", trigger: "blur" }
        ],
        Outsourcing: [
          { required: true, message: "外采外协合计不能为空", trigger: "blur" }
        ],
        JnPurFGoodsAmount: [
          { required: true, message: "境内面料采购金额不能为空", trigger: "blur" }
        ],
        JWPurFGoodsAmount: [
          { required: true, message: "境外面料采购金额不能为空", trigger: "blur" }
        ],
        JnPurAGoodsAmount: [
          { required: true, message: "境内辅料采购金额不能为空", trigger: "blur" }
        ],
        JWPurAGoodsAmount: [
          { required: true, message: "境外辅料采购金额不能为空", trigger: "blur" }
        ],
        QTCHAmount: [
          { required: true, message: "其他采购费用不能为空", trigger: "blur" }
        ],
        RKAmount: [
          { required: true, message: "面料入库金额不能为空", trigger: "blur" }
        ],
        rkamountF: [
          { required: true, message: "面料出库金额不能为空", trigger: "blur" }
        ],
        CKAmount: [
          { required: true, message: "面料出库金额不能为空", trigger: "blur" }
        ],
        ckamountF: [
          { required: true, message: "辅料出库金额不能为空", trigger: "blur" }
        ],
        SKStatus: [
          { required: true, message: "收款状态不能为空", trigger: "change" }
        ],
        id: [
          { required: true, message: "$comment不能为空", trigger: "blur" }
        ],
        PaidAmount: [
          { required: true, message: "$comment不能为空", trigger: "blur" }
        ],
        UnPayMoney: [
          { required: true, message: "$comment不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询服装鞋部合同台账列表 */
    getList() {
      this.loading = true;
      listFztz(this.queryParams).then(response => {
        this.fztzList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        Price: null,
        PurPrice: null,
        ContractDate: null,
        EXPContractID: null,
        YEARs: null,
        wk: null,
        PIStatus: null,
        BillNo: null,
        Season: null,
        GoodsNo: null,
        BatchNo: null,
        CustomerName: null,
        userName: null,
        DeliveryDate: null,
        Num: null,
        GoodsAmount: null,
        Currency: null,
        Remark: null,
        ToRMBRate: null,
        ExpContractDetailID: null,
        YJLRL: null,
        YJML: null,
        SJLRL: null,
        SJML: null,
        GCStatus: null,
        SupplierShortName: null,
        pDeliveryDate: null,
        PurNum: null,
        PurAmount: null,
        PurCurrency: null,
        ShipNum: null,
        DFDate: null,
        AccountMoney: null,
        PayDate: null,
        FKBL: null,
        FKStatus: null,
        CGAmount: null,
        CGZB: null,
        CPRatio: null,
        BJRatio: null,
        FabricRatio: null,
        AccessoriesRatio: null,
        OutsourcingRatio: null,
        Outsourcing: null,
        PurFGoodsAmount: null,
        JnPurFGoodsAmount: null,
        JWPurFGoodsAmount: null,
        PurAGoodsAmount: null,
        JnPurAGoodsAmount: null,
        JWPurAGoodsAmount: null,
        QTCHAmount: null,
        RKAmount: null,
        rkamountF: null,
        CKAmount: null,
        ckamountF: null,
        SKStatus: null,
        PaymentType: null,
        SJShipNum: null,
        InvoiceDate: null,
        YSDQDate: null,
        SAccountMoney: null,
        TotalReceivedMoney: null,
        SXFee: null,
        RecDate: null,
        currencyName: null,
        UnReceivedMoney: null,
        unreceivedmoneyNew: null,
        SKBL: null,
        id: null,
        SQPaidAmount: null,
        WSQUnPayMoney: null,
        ActualAmount: null,
        SQUNPaidAmount: null,
        SQUnPayMoney: null,
        PAmount: null,
        yAmount: null,
        PaidAmount: null,
        UnPayMoney: null,
        DJBL: null,
        DJAmount: null,
        DJYFDate: null,
        YRecDate: null,
        YWriteAmount: null,
        FKAmount: null,
        SKAmount: null,
        ordertype: null,
        GoodsAmountToRMB: null,
        SKAmountToRMB: null,
        Addition: null,
        Subtract: null,
        userID: null,
        GCContractDate: null,
        BJGoodsAmount: null,
        CPGoodsAmount: null,
        cbsMf: null,
        cbsFee: null,
        WXGoodsAmountLimit: null,
        LossAmount: null,
        CreditAmount: null,
        CompanyShortName: null,
        ContractType: null,
        CustomerID: null,
        PurContractNo: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.Price)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加服装鞋部合同台账";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const Price = row.Price || this.ids
      getFztz(Price).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改服装鞋部合同台账";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.Price != null) {
            updateFztz(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addFztz(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const Prices = row.Price || this.ids;
      this.$modal.confirm('是否确认删除服装鞋部合同台账编号为"' + Prices + '"的数据项？').then(function() {
        return delFztz(Prices);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/fztz/export', {
        ...this.queryParams
      }, `fztz_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
